package net.sk.china.front.service.product;

import com.baomidou.mybatisplus.extension.service.IService;
import net.sk.china.common.model.product.StoreProductAttrValue;

import java.util.List;

/**
 * StoreProductAttrValueService 接口实现
 * +----------------------------------------------------------------------
 * | Talk To [ 聊来改善地区金融服务环境，助力企业发展 ]
 * +----------------------------------------------------------------------
 * | Copyright (c) 2018-2024 聊来All rights reserved.
 * +----------------------------------------------------------------------
 * | Licensed ( <a href="http://www.apache.org/licenses/LICENSE-2.0">apache</a> )
 * +----------------------------------------------------------------------
 * | @Author: 聊来 <18970881148@qq.com>
 * +----------------------------------------------------------------------
 * | DateTime: 2024/6/12 16:44
 * +----------------------------------------------------------------------
 */
public interface StoreProductAttrValueService extends IService<StoreProductAttrValue> {

    /**
     * 获取商品规格列表
     * @param productId 商品id
     * @param type 商品类型
     * @return {@code List<StoreProductAttrValue>}
     */
    List<StoreProductAttrValue> getListByProductIdAndType(Integer productId, Integer type);

    /**
     * 根据商品id和attrId获取列表集合
     * @param productId 商品id
     * @param attrId 属性id
     * @param type 商品类型
     * @return {@code List<StoreProductAttrValue>}
     */
    List<StoreProductAttrValue> getListByProductIdAndAttrId(Integer productId, String attrId, Integer type);

    /**
     * 根据id、类型查询
     * @param id ID
     * @param type 类型
     * @return {@code StoreProductAttrValue}
     */
    StoreProductAttrValue getByIdAndProductIdAndType(Integer id, Integer productId, Integer type);

    /**
     * 添加/扣减库存
     * @param id 秒杀商品id
     * @param num 数量
     * @param operationType 类型：add—添加，sub—扣减
     * @param type 活动类型 0=商品，1=秒杀，2=砍价，3=拼团
     * @return {@code boolean}
     */
    boolean operationStock(Integer id, Integer num, String operationType, Integer type);
}
